<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>1.4.4变量语法细节</title>
    <!-- 1.更新变量的值 -->
    <script>
        var myname = '小楠';
        conslole.log('myname');
        myname = '小红'; //更新变量的值 一个变量重新赋值后，会覆盖原有值。
        console.log(myname); //输出结果：小红
    </script>
</head>

<body>

</body>

</html>


<!-- 我是分界线-------------------------------------------------我是分界线----- -->
<!-- 2.同时声明多个变量 -->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>同时声明多个变量</title>
    <script>
        //同时声明多个变量不赋值
        var myName, age, email;
        //同时声明多个变量并赋值
        age = 18;
        email = 'jiejiek@.gitee.com';
    </script>
</head>

<body>

</body>

</html>
<!-- 我是分界线------------------------------------------------------我是分界线 -->
<!-- 3.声明变量的特殊情况 -->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        var age;
        console.log(age); //不给予赋值会弹出undefined。程序会出错。

        //直接赋值一个未声明的变量，也能正确输出
        age = 10;
        console.log(age);
    </script>
</head>

<body>

</body>

</html>